# 汉字田
# 2025/5/1

from collections import defaultdict
from itertools import combinations
from math import gcd


def count():
    # 找到所有的点
    points = set()
    for i in range(3):
        for j in range(3):
            points.add((i, j))

    # 计算所有的直线
    lines = set()
    for x1, y1 in points:
        for x2, y2 in points:
            if x1 == x2 and y1 == y2:
                continue
            if x1 != x2:
                if y1 == y2:
                    k = 0
                else:
                    k = (y1 - y2) / (x1 - x2)
                b = (x1 * y2 - x2 * y1) / (x1 - x2)
            else:
                k = float("inf")
                b = x1
            lines.add((k, b))

    # 统计每条直线上通过的点
    cnt_map = defaultdict(int)
    for x, y in points:
        for k, b in lines:
            if k * x + b == y:
                cnt_map[(k, b)] += 1

    # 统计
    cnt = 0
    for v in cnt_map.values():
        if v == 2:
            cnt += 1
    return cnt


def count_opt():
    # 找到所有的点
    points = [(i, j) for i in range(3) for j in range(3)]

    # 计算所有的直线（使用 Ax + By + C = 0 标准形式，并归一化）
    lines = set()
    for (x1, y1), (x2, y2) in combinations(points, 2):
        A = y2 - y1
        B = x1 - x2
        C = x2 * y1 - x1 * y2

        # 归一化系数：确保最大公约数为1，且首项非负
        g = gcd(gcd(A, B), C)
        if g != 0:
            A //= g
            B //= g
            C //= g

        if A < 0 or (A == 0 and B < 0):
            A = -A
            B = -B
            C = -C

        lines.add((A, B, C))

    # 统计每条直线上通过的点
    cnt_map = defaultdict(int)
    for x, y in points:
        for A, B, C in lines:
            if A * x + B * y + C == 0:
                cnt_map[(A, B, C)] += 1

    # 统计恰好经过两个点的直线数量
    cnt = 0
    for v in cnt_map.values():
        if v == 2:
            cnt += 1
    return cnt


if __name__ == '__main__':
    print(count())
    print(count_opt())
